﻿@using SCMS.Resource
@model SCMS.UI.Models.PPModel
           
@{AjaxOptions ajaxOpts = new AjaxOptions
    {
        UpdateTargetId = "requestDiv",
        LoadingElementId = "loading",
        HttpMethod = "Post",
        Url = Url.Action("AddPPItems2OR"),
        OnBegin = "return CheckIfOneIsSelected()"
    };
}

<div class="partialViewCard">
    <div class="partialViewCardHeader"><h3>@Resources.OrderRequest_AddPPItems2OR_Header :: @Model.EntityPP.ProjectDonor.ProjectNumber</h3></div>
    <br />

    <table width="98%" align="center" cellpadding="0" class="cardTable">
        <tr>
            <th align="center" width="33%">
                @Resources.OrderRequest_AddPPItems2OR_OfficePreparing
            </th>
            <th align="center" width="33%">
                @Resources.Global_String_PreparedBy 
            </th>
            <th align="center" colspan="2">
                @Resources.Global_String_Date
            </th>
        </tr>
        <tr>
            <td align="center" valign="top">
                @Model.EntityPP.CountrySubOffice.Name
            </td>
            <td align="center" valign="top">
                @Model.EntityPP.Staff.Person.FirstName
                &nbsp;
                @Model.EntityPP.Staff.Person.OtherNames
            </td>
            <td align="center" colspan="2">
                @Model.EntityPP.PreparedOn.ToString("dd/MM/yyyy")
            </td>
        </tr>
        <tr>
            <th align="center">
                @Resources.Budget_CategoryList_ProjectNo
            </th>
            <th align="center">
                @Resources.Global_String_PreparedByTitle
            </th>
            <th align="center" colspan="2">
                @Resources.Global_String_ORCurrency
            </th>
        </tr>
        <tr>
            <td align="center" title="@Model.EntityPP.ProjectDonor.Project.Name">
                @Model.EntityPP.ProjectDonor.ProjectNumber
            </td>
            <td align="center">
                @Model.EntityPP.Staff.Designation.Name
            </td>
            <td align="center" colspan="2">
                @ViewBag.Currency
            </td>
        </tr>
    </table> 
    <br />
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
    {
        @Html.ValidationSummary(true)
        @Html.HiddenFor(m => m.OrderRequestId)
        if (Model.PPItems.Count > 0)
        {
            <table align="center" width="98%" class="cardTable">
                <tr>
                    <th>@Resources.OrderRequest_AddPPItems2OR_DescriptionOfGoods</th>
                    <th>@Resources.OrderRequest_AddPPItems2OR_TechincalSpecification</th>
                    <th>@Resources.Global_String_Unit</th>
                    <th>@Resources.Global_String_Qty</th>
                    <th>@Resources.OrderRequest_AddItemInEditMode_EstUnitPrice</th>
                    <th>@Resources.OrderRequest_AddItemInEditMode_EstTotalPrice</th>
                    <th>@Resources.Budget_CreateSubLine_LineNumber</th>
                    <th>@Resources.OrderRequest_AddPPItems2OR_RequiredDeliveryLocation</th>
                    <th>@Resources.OrderRequest_AddPPItems2OR_RequiredDeliveryDate</th>
                    <th>@Resources.OrderRequest_AddPPItems2OR_AddToOR</th>
                </tr>
                @for (int i = 0; i < Model.PPItems.Count; i++ )
                {
                    <tr>                
                        <td>@Model.PPItems[i].EntityPPItem.Item.Name</td>
                        <td>@Model.PPItems[i].EntityPPItem.ItemDescription</td>
                        <td>@Model.PPItems[i].EntityPPItem.Item.UnitOfMeasure.Code</td>
                        <td align="center">@Model.PPItems[i].EntityPPItem.Quantity</td>
                        <td align="right">@Model.PPItems[i].EntityPPItem.UnitCost.ToString("#,##0.00")</td>
                        <td align="right">@Model.PPItems[i].EntityPPItem.TotalCost.ToString("#,##0.00")</td>
                        <td align="center">@Model.PPItems[i].EntityPPItem.ProjectBudget.LineNumber</td>
                        <td>@Model.PPItems[i].EntityPPItem.Location.Name</td>
                        <td align="right">@Model.PPItems[i].EntityPPItem.RequiredDeliveryDate.ToString("dd/MM/yyyy")</td>
                        <td align="center">
                            @Html.CheckBoxFor(m => Model.PPItems[i].EntityPPItem.AddedToOR)
                            @Html.HiddenFor(m => Model.PPItems[i].EntityPPItem.Id)
                        </td>
                    </tr>
                }
            </table>
        }  
    
        <table align="center" width="98%">
            <tr>
                <td width="50%">
                    <input type="button" class="btn green" value="@Resources.OrderRequest_AddPPItems2OR_EditOR" onclick="sendRequest('/ProcurementPlan/EditPP/@Model.OrderRequestId', 'requestDiv', 'loading')" />
                </td>
                <td width="50%" align="right">
                    <input type="submit" class="btn green" value="@Resources.OrderRequest_AddPPItems2OR_AddSelected" />
                </td>
            </tr>
        </table>    
    }
    <br />
</div>
         


